package com.yh.threadTest.task;

/**
 * @ClassName ThreadA
 * @Description TODO
 * @Author 0715-YuHao
 * @Date 2020/11/14 13:51
 */
public class ThreadD implements Runnable {

    private volatile boolean flag = false;

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() + "开始执行");
        for (int i = 0; i < 10; i++) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName() + "正在执行。。。");
        }
        flag = true;
        System.out.println(Thread.currentThread().getName() + "执行完成");
    }

    public boolean isFlag() {
        return flag;
    }
}
